From d4d9c86a251bf515644be60ea8375bd7e45c419f Mon Sep 17 00:00:00 2001 From: "emellor@ewan" Date: Wed, 5 Oct 2005 17:48:36 +0100 Subject: [PATCH] Change boolean config option parsing to allow True and Y and similar useful things. Signed-off-by: Ewan Mellor --- tools/python/xen/xend/XendRoot.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/python/xen/xend/XendRoot.py b/tools/python/xen/xend/XendRoot.py index 5162163cba..f170b1192b 100644 --- a/tools/python/xen/xend/XendRoot.py +++ b/tools/python/xen/xend/XendRoot.py @@ -26,6 +26,7 @@ configured values. import os import os.path +import string import sys from XendLogging import XendLogging @@ -238,10 +239,10 @@ class XendRoot: return sxp.child_value(self.config, name, val=val) def get_config_bool(self, name, val=None): - v = self.get_config_value(name, val) - if v in ['yes', '1', 'on', 'true', 1, True]: + v = string.lower(str(self.get_config_value(name, val))) + if v in ['yes', 'y', '1', 'on', 'true', 't']: return True - if v in ['no', '0', 'off', 'false', 0, False]: + if v in ['no', 'n', '0', 'off', 'false', 'f']: return False raise XendError("invalid xend config %s: expected bool: %s" % (name, v)) -- 2.30.2